//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_KTHREAD_H__
#define __ELASTOS_KTHREAD_H__

typedef Int32 (CDECL *threadroutine_t)(void *);

EXTERN void DzSleep();
EXTERN void DzSleep(uint_t uTicks, WaitResult *pResult);

EXTERN void DzYield();

EXTERN ECode DzGetCurrentThread(IThread **ppCurrentThread);

EXTERN bool_t DzIsSystemThread(IThread *pThread);

#define TF_MINIMUM_AVAILABLE    8

EXTERN bool_t DzAcquireThreadFieldSlot(uint_t *puFieldIndex);

EXTERN void **DzGetThreadFieldAddress(uint_t uFieldIndex);

typedef enum CreateThreadFlag
{
    CreateThreadFlag_System     = 0x80,
} CreateThreadFlag;

EXTERN ECode DzCreateKernelThread(threadroutine_t threadroutine, PVoid pvArg,
                UInt32 flags, ThreadPriorityRank priorityRank,
                IThread **ppThread);

#endif //__ELASTOS_KTHREAD_H__
